-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use google translate #189
Use google translate #189
Conversation
g especially if it merges an updated upstream into a topic branch.
Deploying nepalingo with Cloudflare Pages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments, feel free to merge the PR in after you address them
nepalingo-web/package.json
Outdated
"lottie-react": "^2.4.0", | ||
"node-fetch": "^3.3.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need these packages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove them and re-generate the pnpm lock file?
if (newariResult.meanings.length === 0) { | ||
console.log("Used Google Translate for newari"); | ||
return await getGTranslate("newari", word); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and simple! This is some nice DRY code!
case "Tajpuriya": | ||
return await getTajpuriyaWord(word); | ||
case "Maithili": | ||
return await getGTranslate("maithili", word); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooo I like that
}> => { | ||
const targetLanguage = languageCodes[language]; | ||
if (!targetLanguage) { | ||
throw new Error(`Language code for ${language} not found`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new Error(`Language code for ${language} not found`); | |
throw new Error(`Google translate language code for ${language} not found`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change will make it more clear why the error is occurring and hints at what file to look at.
@@ -0,0 +1,45 @@ | |||
const GOOGLE_TRANSLATE_API_KEY = "AIzaSyCi239eredIAEEJkI8xzvGwW1GPS7B1vxQ"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this into the .env
file
Nice thanks for testing and catching that env var error before merging! |
added a getGTranslate lib
Udated the useDictionary to use getGTranslate for maithili and for newari backup.
challenges:
Error: Requests from referer http://localhost:5173/ are blocked.
can't test it because of this error.
Tried setting up a proxy server (have created a file called proxy.js) but am not sure about it and don't know how to use it.